package com.kust.smarthome.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kust.smarthome.web.mapper.PositionMapper;
import com.kust.smarthome.web.model.Position;
import com.kust.smarthome.web.service.IPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> implements IPositionService {

    @Autowired
    private PositionMapper positionMapper;

    @Override
    public Position getByUserId(int userId) {

        QueryWrapper<Position> query = new QueryWrapper<>();
        query.eq("user_id", userId);

        return positionMapper.selectOne(query);
    }
}
